package day01;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

public class InetSocketAddressDemo01 {
    public static void main(String[] args) throws UnknownHostException {
        InetSocketAddress  inetSocketAddress = new InetSocketAddress(8090);
        System.out.println("ip="+inetSocketAddress.getAddress().getHostAddress()+
                ",hostname:"+inetSocketAddress.getHostName()+"port="+inetSocketAddress.getPort());
        InetSocketAddress isa1 = new InetSocketAddress(InetAddress.getByName("www.baidu.com"),80);
        System.out.println("百度IP："+isa1.getAddress().getHostAddress()+"主机名"+isa1.getHostName());
    }
}
